/******************************************************************************
*
*               Copyright Mentor Graphics Corporation 2003
*                           All rights reserved
*
*   THIS WORK CONTAINS TRADE SECRETS AND PROPRIETARY INFORMATION WHICH IS
*    THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
*                        SUBJECT TO LICENSE TERMS
*
*******************************************************************************

*******************************************************************************
* FILE NAME                                                          VERSION
* act_struct_pointer_chain_test.c                                        1.1
*
* COMPONENT
* ANSI/ISO C test application
*
* DESCRIPTION
* Demonstrates the use of pointer's to access the structure.
*
* FUNCTIONS
* int act_struct_pointer_chain_test(int value)
*
* DEPENDENCIES
* act_test.h
******************************************************************************/

#include "act_test.h"

#if (ACT_STRUCT_POINTER_CHAIN_TEST)

typedef struct
{
     int a, b, c;

}IntStruct;


typedef struct
{
     IntStruct *pIntStruct;

}StructObject;



void InitStruct1 (StructObject *pSObject)
{

     pSObject->pIntStruct->a = 1;
     pSObject->pIntStruct->b = 2;
     pSObject->pIntStruct->c = 3;


}

void InitStruct2 (StructObject *pSObject)
{
     IntStruct *pIStruct = pSObject->pIntStruct;
   
     pIStruct->a = 4;
     pIStruct->b = 5;
     pIStruct->c = 6;

}
  
/******************************************************************************
* FUNCTION
* int act_struct_pointer_chain_test(int value)
*
* DESCRIPTION
* Demonstrates the use of pointer's to access the structure.
*
* INPUTS
* int value                     Counter value from ansi_c_test(..) in act.c
*
* OUTPUTS
* int                           returns 1
******************************************************************************/

int act_struct_pointer_chain_test(int value)
{
     IntStruct Object;
	 StructObject SObject;
	 SObject.pIntStruct = &Object;


  	 InitStruct1(&SObject);
  	 InitStruct2(&SObject);
  	
  	 Object.a = 8;
  	 SObject.pIntStruct->b = 9;
  	 Object.c = 10;

     return 1;
}
#endif
  

  
  



